<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\assets\AppAsset;  

/* @var $this yii\web\View */
/* @var $model app\models\UserPoker */
/* @var $form yii\widgets\ActiveForm */

$this->registerCssFile('http://poker.520code.cc/basic/jedate/skin/jedate.css',['depends' => [\yii\web\JqueryAsset::className()]]);  
 
 $this->registerJsFile('http://poker.520code.cc/basic/jedate/jquery.jedate.js',['depends' => [\yii\web\JqueryAsset::className()]]);  


    $sql = "select ua.user_id,user_agent_id , name from user_agent ua ,user_info ui where ua.user_agent_id = ui.user_id";

    $user_id = 0;
    if(isset($_GET["user_id"])){
        $user_id = $_GET["user_id"];
    }

    if($user_id > 99){
        $sql = "select ua.user_id,user_agent_id , name from user_agent ua ,user_info ui where ua.user_agent_id = ui.user_id and ua.user_id = " . $user_id;       
    }
    
    $da = Yii::$app->db->createCommand($sql)->queryAll();

    $value1 =  array('0' => '无');
    foreach ($da as  $value) {
        $user_id = $value["user_id"];
        $user_agent_id =  $value["user_agent_id"] . '';
        $name = $value["name"].'';
        
        $value1[$user_agent_id]  = $name;

    }

    $sql = "select * from club_info;";
    $da = Yii::$app->db->createCommand($sql)->queryAll();
    $value2 =  array('0' => '无');
    foreach ($da as  $value) {
        
        $user_agent_id =  $value["club_id"] . '';
        $name = $value["name"].'';
        
        $value2[$user_agent_id]  = $name;

    }
    


?>

<div class="user-poker-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'user_id')->textInput(['value'=> ( isset($_GET['user_id']) ? $_GET['user_id']:$model->user_id )  ]  ) ?>

    <?= 
    
    

    $form->field($model, 'user_agent_id')->dropdownList($value1);

    ?>

        <?= 

    $form->field($model, 'club_id')->dropdownList($value2);

    ?>


    <?= $form->field($model, 'table_id')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'poker_name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'score')->textInput() ?>

    <?= $form->field($model, 'in_score')->textInput() ?>

    <?= $form->field($model, 'out_score')->textInput() ?>

    <?= $form->field($model, 'end_score')->textInput() ?>
    <?= $form->field($model, 'ts')->textInput() ?>


    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '创建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
<script src="/basic/web/assets/31f45ab6/jquery.js"></script>
<script type="text/javascript">
    

    $('#userpoker-score').bind('input', function() { 
        var score = $(this).val() // get the current value of the input field.


        $("#userpoker-in_score").val((score*0.95 |0));

        $("#userpoker-out_score").val(Math.abs(score*0.025 ) |0);

        $("#userpoker-end_score").val((score*0.975 ) |0);


        
    });


    $(document).ready(function(){

      $("#userpoker-ts").jeDate({
            isinitVal:true,
            festival:true,
            
            format:"YYYY-MM-DD",
    
    });


    });

    




</script>